#pragma once

#include "IRenderObject.h"
#include <SDKmesh.h>

struct ID3D10Effect;
struct ID3D10Buffer;
struct ID3D10InputLayout;
struct ID3D10Device;

namespace e3d 
{
	class Player : public IRenderObject
	{
	public:
		Player(	ID3D10Device* device, ID3D10Effect* effect, 
				D3DXVECTOR3 position = D3DXVECTOR3( 0,0,0 ), 
				D3DXVECTOR3 rotation = D3DXVECTOR3( 0,0,0 ), 
				D3DXVECTOR3 size = D3DXVECTOR3( 1,1,1 ) );
		~Player();

		virtual const D3DXVECTOR3& position() const { return m_position; };
		virtual const D3DXVECTOR3& rotation() const { return m_rotation; };
		virtual const D3DXVECTOR3&  size() const { return m_size; };
		unsigned int LOD() const { return 0; };
		unsigned int resolution() const { return 1; };

		virtual void position( const D3DXVECTOR3& newPos ){ m_position = newPos; };
		virtual void rotation( const D3DXVECTOR3& newRot ){ m_rotation = newRot; };
		virtual void size( const D3DXVECTOR3& newSize ) { m_size = newSize; };

		virtual e3d::BoundingBox boundingBox() const;
		virtual void renderBoundingBox( bool isEnabled ){ /*not implemented*/ UNREFERENCED_PARAMETER(isEnabled); };
		
		virtual bool active() const { return m_isActive; };
		virtual void active( bool status ){ m_isActive = status; };
		virtual bool isCastingShadows(){ return true; };

		virtual void render( ID3D10EffectTechnique* tech, const D3DXVECTOR3* camPos );

		bool loadMeshes(ID3D10Device* pd3dDevice);
		void releaseDxutMeshes(ID3D10Device* pd3dDevice);


	private:
		D3DXVECTOR3 m_position;
		D3DXVECTOR3 m_rotation;
		D3DXVECTOR3 m_size;

		bool m_isActive;

		e3d::ColoredVertex m_vertices[8];

		ID3D10Effect* m_effect;
		ID3D10Device* m_device;

		// Waffenmodel
		static CDXUTSDKMesh s_playerWeaponMesh;
		ID3D10InputLayout* m_weaponMeshLayout;

		// Waffentextur
		static ID3D10ShaderResourceView* s_playerWeaponTexture;


		unsigned short m_health;

	};

}
